java.lang.Object
edu.uky.ai.lp.logic.KnowledgeBase
public class KnowledgeBase
extends java.lang.Object
A knowledge base is a collection of facts and rules that describe a logical
universe.
- Author:
- Stephen G. Ware
-
Field Summary
Fields
| Modifier and Type |
Field |
Description |
java.lang.Iterable<Fact> |
facts |
All the facts in this knowledge base
|
java.lang.Iterable<Rule> |
rules |
All the rules in this knowledge base
|
-
Constructor Summary
Constructors
| Constructor |
Description |
KnowledgeBase(Rule[] rules,
Fact[] facts) |
Constructs a new knowledge base with the given rules and facts.
|
-
Method Summary
| Modifier and Type |
Method |
Description |
void |
addFact(Fact fact) |
Adds a new fact to the knowledge base.
|
void |
addRule(Rule rule) |
Adds a new rule to the knowledge base.
|
java.lang.String |
toString() |
|
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
public final java.lang.Iterable<Rule> rules
All the rules in this knowledge base
-
public final java.lang.Iterable<Fact> facts
All the facts in this knowledge base
-
Constructor Details
-
public KnowledgeBase(
Rule[] rules,
Fact[] facts)
Constructs a new knowledge base with the given rules and facts.
- Parameters:
rules - the rules
facts - the facts
-
Method Details
-
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
-
public void addRule(
Rule rule)
Adds a new rule to the knowledge base.
- Parameters:
rule - the rule to add
-
public void addFact(
Fact fact)
Adds a new fact to the knowledge base.
- Parameters:
fact - the fact to add